package com.t18;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;

/**
 * Created by xuyiwei on 2018/9/2.
 */
public class IntBufferDemo {
    private static final int BSIZE = 1024;
    public static void main(String[] args) {
        ByteBuffer bb = ByteBuffer.allocate(BSIZE);
        IntBuffer ib = bb.asIntBuffer();
        ib.put(new int[]{11,42,47,99,143,811,1016});
        System.out.println(ib.get(3));
        ib.put(4,1811);
        ib.flip();
        while (ib.hasRemaining()){
            int i = ib.get();
            System.out.print(i+" ");
        }
        /**
         * 99
         11 42 47 99 1811 811 1016
         */
    }
}
